/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) 2025 STMicroelectronics.
  * All rights reserved.
  *
  * This software is licensed under terms that can be found in the LICENSE file
  * in the root directory of this software component.
  * If no LICENSE file comes with this software, it is provided AS-IS.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H

#ifdef __cplusplus
extern "C" {
#endif



/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
#include "cmsis_os.h"

typedef __IO uint32_t  vu32;
typedef __IO uint16_t vu16;
typedef __IO uint8_t  vu8;

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

extern uint8_t lip[4];/*����lp����*/


#define rs485_cs1_port GPIOA
#define rs485_cs1_pin GPIO_PIN_11

#define rs485_cs2_port GPIOA
#define rs485_cs2_pin GPIO_PIN_4


extern SPI_HandleTypeDef hspi2;
extern UART_HandleTypeDef huart1;
extern UART_HandleTypeDef huart2;
extern osSemaphoreId uart1_semHandle;
extern osSemaphoreId uart2_semHandle;
extern osSemaphoreId spi_semHandle;
/* USER CODE END Includes */

// 声明消息队列句柄
extern osMessageQId uartFrameQueueHandle;
extern osMessageQId modbusCommandQueueHandle;
extern osPoolId uartCmdPoolHandle;    // UART命令内存池句柄
extern osPoolId modbusPoolHandle;     // Modbus命令内存池句柄
/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
void UART_IDLECallback(UART_HandleTypeDef *huart);
/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */

/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);

/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/

/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

#ifdef __cplusplus
}
#endif

#endif /* __MAIN_H */
